package com.refuel.enumeration;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * @author zhanghao
 * @description 商品类型枚举类
 * @date 2024/5/10 09:15
 **/
@Schema(description = "商品类型枚举")
public enum GoodsItemType {

    /**
     * 充值卡
     */
    @Schema(description = "商品")
    GOODS("GOODS", "商品"),

    /**
     * 充值卡
     */
    @Schema(description = "加油卡")
    REFUEL_CARD("REFUEL_CARD", "加油卡"),

    /**
     * 积分
     */
    @Schema(description = "积分")
    INTEGRAL("INTEGRAL", "积分"),

    /**
     * 礼品
     */
    @Schema(description = "礼品")
    GIFT("GIFT", "礼品"),
    ;

    /**
     * 名称
     */
    private String name;

    /**
     * 描述
     */
    private String desc;

    GoodsItemType(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    /**
     * 判断商品类型是否存在
     * @param typeName 商品类型名称
     * @return true:存在，false:不存在
     */
    public static Boolean inGoodsItems(String typeName) {
        for (GoodsItemType itemType : GoodsItemType.values()) {
            if (itemType.getName().equals(typeName)) {
                return true;
            }
        }

        return false;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
